package net.lab1024.sa.admin.module.sast.tool.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import net.lab1024.sa.admin.module.sast.tool.domain.LlmConfigEntity;
import net.lab1024.sa.admin.module.sast.tool.domain.LlmVO;
import net.lab1024.sa.admin.module.sast.tool.service.LlmService;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/llm")
@Tag(name = "大模型使用管理")
public class llmController {


    @Resource
    private LlmService llmService;

    @Operation(summary = "查询大模型配置")
    @GetMapping("/query/{uuid}")
    public ResponseDTO<LlmVO> getByUuid(@PathVariable String uuid) {
        return ResponseDTO.ok(llmService.getByUuid(uuid));
    }

    @Operation(summary = "创建大模型配置")
    @GetMapping("/create")
    public ResponseDTO<String> create(LlmConfigEntity toolConfig) {
        llmService.create(toolConfig);
        return ResponseDTO.ok();
    }

    @Operation(summary = "更新大模型配置")
    @GetMapping("/update")
    public ResponseDTO<String> update(LlmConfigEntity toolConfig) {
        llmService.update(toolConfig);
        return ResponseDTO.ok();
    }
}
